package edu.guet.cn.blogbasics.config;


import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/*
 * <p>
 *  Web配置,跨域支持
 * </p>
*/


@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**") //所有站点都可以访问
                .allowCredentials(true)
                .allowedHeaders("*")
                .allowedOrigins("*")
                .maxAge(3600)
                .allowedMethods("GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS");
    }


}
